<?php

class Soul_Validation_Validator {
	
	private $_data = array();
	
	public function setData(array $value){
		$this->_data = $value;
		return $this;
	}
	
	public function getData(){
		return $this->_data;
	}
	
	public function getValue($name){
		if(isset($this->_data[$name])){
			return $this->_data[$name];
		}
		return '';
	}

	public function notEmpty($name){
		return Soul_Validation_Helper::notEmpty($this->getValue($name));
	}

	public function isInteger($name){
		return Soul_Validation_Helper::isInteger($this->getValue($name));
	}

	public function isDigit($name){
		return Soul_Validation_Helper::isDigit($this->getValue($name));
	}

	public function isNumeric($name){
		return Soul_Validation_Helper::isNumeric($this->getValue($name));
	}

	public function isEmail($name){
		return Soul_Validation_Helper::isEmail($this->getValue($name));
	}

	public function isDateTime($name){
		return Soul_Validation_Helper::isDateTime($this->getValue($name));
	}
	
	public function maxLength($name, $length){
		return Soul_Validation_Helper::lengthGreat($this->getValue($name));
	}
	
	public function minLength($name, $length){
		return Soul_Validation_Helper::lengthLess($this->getValue($name));
	}
	
	public function rangeLength($name, $min, $max){
		return Soul_Validation_Helper::rangeLength($this->getValue($name));	
	}
	
	public function maxValue($name, $max){
		return Soul_Validation_Helper::maxValue($this->getValue($name));
	}
	
	public function minValue($name, $length){
		return Soul_Validation_Helper::minValue($this->getValue($name));
	}
	
	public function rangeValue($name, $min, $max){
		return Soul_Validation_Helper::rangeValue($this->getValue($name));		
	}	
	
	public function isCharacter($name){
		return Soul_Validation_Helper::isCharacter($this->getValue($name));		
	}	
	
	public function testRegex($name, $pattern){
		return Soul_Validation_Helper::testRegex($this->getValue($name));
	}
	
	public function isIn($name, array $values){
		return in_array($this->getValue($name), $values);
	}
}